#include "speech_server.hpp"


DEFINE_bool(mode,false,"true-发布,false-调试");
DEFINE_string(filename,"file","要保存的文件名");
DEFINE_int32(level,0,"表示日志的输出等级");

DEFINE_string(etcdhost,"http://127.0.0.1:2379","etcd服务器");
DEFINE_string(dir,"/service","服务");
DEFINE_string(host,"127.0.0.1:10001","主机地址");
DEFINE_string(adddir,"/speech_service/instance","服务实例");
DEFINE_int32(listenport,10001,"服务器的监听端口");
DEFINE_int32(timeout,-1,"表示服务器连接超时时间");
DEFINE_int32(numthread,1,"调用RPC的线程数量");


DEFINE_string(app_id,"119121306","id");
DEFINE_string(api_key,"lc1jTdzipLRuzhuoJa6CWnqB","公钥");
DEFINE_string(secret_key,"SomDLUv7Rdp61ZIHTDJkJw6ofzlLDW3h","秘钥");


int main(int argc,char* argv[])
{
     // 关闭brpc中默认的日志系统
    logging::LoggingSettings setting;
    setting.logging_dest = logging::LoggingDestination::LOG_TO_NONE;
    InitLogging(setting);
    google::ParseCommandLineFlags(&argc, &argv, true);
    chatroom::InitLogger(FLAGS_mode,FLAGS_filename,FLAGS_level);
    chatroom::speechServerBuild ssp;
    ssp.make_asr_object(FLAGS_app_id,FLAGS_api_key,FLAGS_secret_key);
    ssp.make_rpc_server(FLAGS_listenport,FLAGS_timeout,FLAGS_numthread);
    ssp.make_reg_object(FLAGS_etcdhost,FLAGS_dir+FLAGS_adddir,FLAGS_host);
    auto server = ssp.build();
    server->start();
    return 0;
}